package org.academic.texteditor.gui.helper;

import java.util.ArrayList;
import java.util.List;

public class Reference {

	private String title;
	private final List<String> authors;
	private int year;
	
	public Reference() {
		this.authors = new ArrayList<String>();
	}

	public String getTitle() {
		return title;
	}

	public void setTitle(String title) {
		this.title = title;
	}

	public int getYear() {
		return year;
	}

	public void setYear(int year) {
		this.year = year;
	}

	public void addAuthor(String author) {
		authors.add(author);
	}
	
	public List<String> getAuthors() {
		return authors;
	}

	@Override
	public String toString() {
		StringBuilder builder = new StringBuilder();
		for (String author : authors) {
			builder.append(author);
			builder.append(" ");
		}
		
		builder.append("(");
		builder.append(year);
		builder.append(")");
		
		return builder.toString();
	}

}
